;-------- GUI START ---------
$maingui = GUICreate("DSO Trader " & $version, $GUI_X, $GUI_Y,1,1,$WS_EX_APPWINDOW)
If ($GUI_bg_color <> "") Then GUISetBkColor($GUI_bg_color)
;-------- GUI INTERFACE ---------
GUICtrlSetStyle(GUICtrlCreateLabel ( $label_interface_name , $group_interface_posX, $group_interface_posY, 60),$SS_RIGHT)
$interface=GUICtrlCreateCombo("", 590, 15, 400,default,$CBS_DROPDOWNLIST)

GUICtrlSetData(-1, $pcap_devices[0][1])
For $i = 0 to Ubound($pcap_devices)-1
	GUICtrlSetData(-1, $pcap_devices[$i][1])
Next
$devanzahl = $i
if $sv_interface > 0 Then
	if $sv_interface <= $devanzahl Then
		_GUICtrlComboBox_SetCurSel($interface, $sv_interface)
	EndIf
EndIf


$stats=GUICtrlCreateButton ( "Stats", 520, 45,60)
If ($button_bg_color <> "") Then GUICtrlSetBkColor($stats, $button_bg_color)
If ($button_txt_color <> "") Then GUICtrlSetColor($stats, $button_txt_color)
GUICtrlSetState (-1, $GUI_DISABLE )

; TODO:
;$tradestats=GUICtrlCreateButton ( "Trading Statistics", 850, 85,100) ;? Position
;$makros=GUICtrlCreateButton ( "Makros", 780, 85,60) ;? Position
;/TODO

;-------- GUI GROUP FILTER ---------
GUICtrlCreateGroup($group_filter_name, $group_filter_posX, $group_filter_posY, 490, 60)
GUICtrlSetStyle(GUICtrlCreateLabel ( "Biete:", 29, 27, 60),$SS_LEFT)
GUICtrlSetStyle(GUICtrlCreateLabel ( "Suche:", 233, 27, 60),$SS_LEFT)

$filter_biete=GUICtrlCreateInPut ("", 25, 43, 200)
If ($input_bg_color <> "") Then GUICtrlSetBkColor($filter_biete, $input_bg_color)
If ($input_txt_color <> "") Then GUICtrlSetColor($filter_biete, $input_txt_color)
$filter_suche=GUICtrlCreateInPut ("", 230, 43, 200)
If ($input_bg_color <> "") Then GUICtrlSetBkColor($filter_suche, $input_bg_color)
If ($input_txt_color <> "") Then GUICtrlSetColor($filter_suche, $input_txt_color)

; alt: $filterstatthighlight=GUICtrlCreateCheckbox ( "Filter (don't highlight)", 510, 45)
	$filterstatthighlight = GUICtrlCreateRadio("Filter", 440, 25, 50, 20)
	$hilightstattfilter = GUICtrlCreateRadio("Highlight", 440, 45, 60, 20)
    GUICtrlSetState ( $hilightstattfilter, $GUI_CHECKED )

GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group
;GUICtrlSetStyle(GUICtrlCreateLabel ( "Highlight :", 10, 50, 60),$SS_RIGHT)


;-------- GUI GROUP Messagetracking ---------
GUICtrlCreateGroup($group_messagetracking_name, $group_messagetracking_posX, $group_messagetracking_posY, 490, 60)

$start=GUICtrlCreateButton ( "Start", 25, 100, 60)
If ($button_bg_color <> "") Then GUICtrlSetBkColor($start, $button_bg_color)
If ($button_txt_color <> "") Then GUICtrlSetColor($start, $button_txt_color)
$stop=GUICtrlCreateButton ( "Stop", 100, 100,60)
If ($button_bg_color <> "") Then GUICtrlSetBkColor($stop, $button_bg_color)
If ($button_txt_color <> "") Then GUICtrlSetColor($stop, $button_txt_color)
GUICtrlSetState (-1, $GUI_DISABLE )
$clear=GUICtrlCreateButton ( "Clear", 175, 100,60)
If ($button_bg_color <> "") Then GUICtrlSetBkColor($clear, $button_bg_color)
If ($button_txt_color <> "") Then GUICtrlSetColor($clear, $button_txt_color)
$autoscroll=GUICtrlCreateCheckbox ( "Autoscroll", 250, 102)
GUICtrlSetState ( $autoscroll, $GUI_CHECKED )

;-------- GUI GROUP Export ---------
GUICtrlCreateGroup($group_export_name, $group_export_posX, $group_export_posY, 120, 60)
$tocsv=GUICtrlCreateCheckbox ( "Live Export to csv", 530, 95)
$exportfiltered=GUICtrlCreateCheckbox ( "filtered Export", 530, 115)
;-------- GUI GROUP Columns ---------
GUICtrlCreateGroup($group_columns_name, $group_columns_posX, $group_columns_posY, 120, 60)
$colview_no=GUICtrlCreateCheckbox ( "Nr", 660, 95)
GUICtrlSetState ( $colview_no, $GUI_CHECKED )
$colview_time=GUICtrlCreateCheckbox ( "Time", 660, 115)
GUICtrlSetState ( $colview_time, $GUI_CHECKED )
;-------- GUI GROUP Misc ---------
GUICtrlCreateGroup($group_misc_name, $group_misc_posX, $group_misc_posY, 120, 60)
$chk_playsound=GUICtrlCreateCheckbox ( "play Sound", 790, 95)
If $playsound = "true" Then
	GUICtrlSetState ( $chk_playsound, $GUI_CHECKED )
Else
	GUICtrlSetState ( $chk_playsound, $GUI_UNCHECKED )
EndIf
;-------- PACKETLIST ---------
$packetwindow = GUICtrlCreateListView("Nr|"& $col_time_name&"|Name|"&$col_message_name&"|"&$col_biete_name&"|"&$col_suche_name&"|"&$col_menge_name&"|"&$col_kurs_name, $listview_posX, $listview_posY, 1030, 400)
_GUICtrlListView_SetColumn($packetwindow,0,$col_nr_name,$col_nr_width,1)
_GUICtrlListView_SetColumn($packetwindow,1, $col_time_name, $col_time_width)
_GUICtrlListView_SetColumn($packetwindow,2,$col_name_name,$col_name_width,0)
_GUICtrlListView_SetColumn($packetwindow, 3, $col_message_name, $col_message_width)
_GUICtrlListView_SetColumn($packetwindow, 4, $col_biete_name, $col_biete_width)
_GUICtrlListView_SetColumn($packetwindow, 5, $col_suche_name, $col_suche_width)
_GUICtrlListView_SetColumn($packetwindow, 6, $col_menge_name, $col_menge_width)
_GUICtrlListView_SetColumn($packetwindow, 7, $col_kurs_name, $col_kurs_width)
if ($ListView_bg_color <> "") Then _GUICtrlListView_SetBkColor($packetwindow, $ListView_bg_color)
;if ($ListView_bg_color <> "") Then _GUICtrlListView_SetBkColor($packetwindow, $CLR_)
if ($ListView_txt_color <> "") Then _GUICtrlListView_SetTextBkColor($packetwindow, $ListView_txt_color)
;MsgBox(0,"", $CLR_MONEYGREEN)
;_GUICtrlListView_SetTextColor($packetwindow, "0x000000")
;GUICtrlSetOnEvent(-1, '_ItemClick')
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($packetwindow, 0x00FF00, 16, 16))
_GUICtrlListView_SetImageList($packetwindow, $hImage, 1)

;-------- CHAT ---------
GUICtrlCreateGroup($group_chat_name, $group_chat_posX, $group_chat_posY, 660, 85)
GUICtrlSetStyle(GUICtrlCreateLabel ( "Whisper:", 31, 562, 60),$SS_LEFT)
GUICtrlSetStyle(GUICtrlCreateLabel ( "Message:", 121, 562, 60),$SS_LEFT)
$whisper = GUICtrlCreateInput( "", 29, 578, 80,20)
If ($input_bg_color <> "") Then GUICtrlSetBkColor($whisper, $input_bg_color)
If ($input_txt_color <> "") Then GUICtrlSetColor($whisper, $input_txt_color)
GUICtrlSetStyle($whisper,$SS_RIGHT)
$sendmessage=GUICtrlCreateInPut ("", 119, 578, 400, 20)
If ($input_bg_color <> "") Then GUICtrlSetBkColor($sendmessage, $input_bg_color)
If ($input_txt_color <> "") Then GUICtrlSetColor($sendmessage, $input_txt_color)
$clip=GUICtrlCreateButton ( "2Clipboard", 530, 576, 60)
If ($button_bg_color <> "") Then GUICtrlSetBkColor($clip, $button_bg_color)
If ($button_txt_color <> "") Then GUICtrlSetColor($clip, $button_txt_color)
$browser=GUICtrlCreateButton ( "2Browser", 595, 576, 60)
If ($button_bg_color <> "") Then GUICtrlSetBkColor($browser, $button_bg_color)
If ($button_txt_color <> "") Then GUICtrlSetColor($browser, $button_txt_color)
$join27=GUICtrlCreateButton ( "join Channel 27", 25, 605, 85)
If ($button_bg_color <> "") Then GUICtrlSetBkColor($join27, $button_bg_color)
If ($button_txt_color <> "") Then GUICtrlSetColor($join27, $button_txt_color)
$postUserLink=GUICtrlCreateButton ( "Post Userlink", 190, 605, 85)
If ($button_bg_color <> "") Then GUICtrlSetBkColor($postUserLink, $button_bg_color)
If ($button_txt_color <> "") Then GUICtrlSetColor($postUserLink, $button_txt_color)
$join27_2Clip=GUICtrlCreateCheckbox ( "2Clipboard", 115, 607, 70)
If ($chkbox_bg_color <> "") Then GUICtrlSetBkColor($join27_2Clip, $chkbox_bg_color)
If ($chkbox_txt_color <> "") Then GUICtrlSetColor($join27_2Clip, $chkbox_txt_color)
$UserLink_2Clip=GUICtrlCreateCheckbox ( "2Clipboard", 280, 607, 70)
If ($chkbox_bg_color <> "") Then GUICtrlSetBkColor($UserLink_2Clip, $chkbox_bg_color)
If ($chkbox_txt_color <> "") Then GUICtrlSetColor($UserLink_2Clip, $chkbox_txt_color)

GUISetState()

;-------- GUI END ---------